xen/arm64: ensure that the correct SP is used for exceptions
authorKyle J. Temkin <temkink@ainfosec.com>
Thu, 28 Apr 2016 17:14:07 +0000 (13:14 -0400)
committerStefano Stabellini <sstabellini@kernel.org>
Wed, 4 May 2016 09:35:52 +0000 (10:35 +0100)
commitb7e5aee0a36487d6205c1633add25fd430d3b6d7
tree195235d9bdf7d6b12fda7250c5e54a399a17429c
parent359cf73565bddafc8cba81fe91231be27d16b106
xen/arm64: ensure that the correct SP is used for exceptions

The ARMv8 architecture has a SPSel ("stack pointer selection") machine
register that allows us to determine which exception level's stack
pointer is loaded when an exception occurs. As we don't want to
use the non-privileged SP_EL0 stack pointer -- or even assume that SP_EL0
points to a valid address in the hypervisor context--  we'll need to ensure
that our EL2 code sets the SPSel to SP_ELn mode, so exceptions that trap
to EL2 use the EL2 stack pointer.

This corrects an issue that can manifest as a hang-on-IRQ on some
arm64 cores if the firmware/bootloader has previously initialized SPSel
to 0; in which case Xen's exceptions will incorrectly use an invalid SP_EL0,
and will endlessly spin on the synchronous abort handler.

Signed-off-by: Kyle Temkin <temkink@ainfosec.com>
Signed-off-by: Stefano Stabellini <sstabellini@kernel.org>
Reviewed-by: Julien Grall <julien.grall@arm.com>
xen/arch/arm/arm64/head.S